home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Resource F251228222001.psc / CSOUND.cls < prev    next >
Encoding:
Visual Basic class definition  |  2000-01-06  |  1.9 KB  |  59 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "CSOUND"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. '------------------------------------------------------------
  15. ' Author:  Clint LaFever [lafeverc@usa.net]
  16. ' Purpose:  Used to play .WAV files.
  17. ' Parameters:
  18. ' Example:
  19. ' Date: July,21 1998 @ 19:27:13
  20. '------------------------------------------------------------
  21. Option Explicit
  22. Private Declare Function sndPlaySound Lib "winmm" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
  23. Private mstrSOUND As String
  24. Public Enum SoundPlayingOptions
  25.     SND_SYNC = &H0         '  play synchronously (default)
  26.     SND_ASYNC = &H1         '  play asynchronously
  27.     SND_LOOP = &H8         '  loop the sound until next sndPlaySound
  28. End Enum
  29. Public Property Get SoundFile() As String
  30.     SoundFile = mstrSOUND
  31. End Property
  32. Public Property Let SoundFile(pstr As String)
  33.     mstrSOUND = pstr
  34. End Property
  35. '------------------------------------------------------------
  36. ' Author:  Clint LaFever [lafeverc@usa.net]
  37. ' Purpose:  Method to play a passed .WAV file or the objects .SoundFile Property.
  38. ' Parameters:
  39. ' Example:
  40. ' Date: July,21 1998 @ 19:27:48
  41. '------------------------------------------------------------
  42. Public Function Play(Optional sOPTION As SoundPlayingOptions = SND_ASYNC, Optional sNAME = "") As Long
  43.     On Error Resume Next
  44.     Dim ret As Long
  45.     If IsNumeric(sNAME) Then
  46.         Me.SoundFile = App.Path & LoadResString(sNAME)
  47.         sNAME = ""
  48.     End If
  49.     If sNAME = "" Then sNAME = Me.SoundFile
  50.     If sNAME <> "" Then
  51.         ret = sndPlaySound(sNAME, sOPTION)
  52.     End If
  53.     Play = ret
  54. End Function
  55.  
  56.  
  57.  
  58.  
  59.